package com.hmy.finance.controller.coreData;

import com.hmy.ccp.common.result.JsonResult;
import com.hmy.finance.bo.coreData.request.GenerateDailyFeeBillRequest;
import com.hmy.finance.job.core.DailyFeeBillGenerationJobHandler;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 财务核心数据处理
 *
 * @author kwaiiiii
 */
@Validated
@RestController
@RequestMapping("/api/coreData")
public class FinanceCoreDataController {
    @Resource
    private DailyFeeBillGenerationJobHandler dailyFeeBillGenerationJobHandler;

    /**
     * 生成完整日费用流水
     *
     * @param request 请求参数
     * @return 是否成功
     * @author songkf
     */
    @PostMapping("/generateDailyFeeBill")
    public JsonResult<String> generateDailyFeeBill(@RequestBody GenerateDailyFeeBillRequest request) {
        dailyFeeBillGenerationJobHandler.generateDailyInvoiceBill(request.getStartDate(), request.getEndDate(), request.getContractId());
        return JsonResult.success("处理结束,具体结果请查看相关数据表");
    }
}
